﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace Fx.Data
{
    public class PageItem
    {
        private readonly int _pageIndex;
        private readonly int _pageSize;
        private readonly IList<Expression> filters;
        private readonly IList<Expression> orders;

        public PageItem(int pageIndex, int pageSize)
        {
            _pageIndex = pageIndex;
            _pageSize = pageSize;
        }

        public int PageIndex
        {
            get
            {
                return _pageIndex;
            }
        }

        public int PageSize
        {
            get
            {
                return _pageSize;
            }
        }

        public int TotalRows { get; set; }

        public int TotalPages
        {
            get
            {
                var totalPages = 0;
                if (PageSize != 0)
                    totalPages = (int)Math.Ceiling((float)TotalRows / (float)PageSize);
                return totalPages;
            }
        }

        public object Items { get; set; }
        
    }
}
